package com.projecy.system.controller;

import com.projecy.common.exception.BadRequestException;
import com.projecy.common.utils.ResultUtil;
import com.projecy.system.model.dto.LogDto;
import com.projecy.system.service.SysLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/sys")
public class SysLogController extends ResultUtil {
    @Autowired
    SysLogService logService;
    //查询日志列表
    @GetMapping("/log/list")
    public ResponseEntity<Object> getLogList(LogDto logDto){
        System.out.println("查询日志列表");
        try {
            return success(true, logService.getLogList(logDto));
        } catch (BadRequestException e) {
            e.printStackTrace();
            return fail(false, e.getMsg());
        }
    }
}
